/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * Autogenerated by Thrift Compiler (0.9.2)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package backtype.storm.generated;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-2-22")
public class MetricSnapshot implements org.apache.thrift.TBase<MetricSnapshot, MetricSnapshot._Fields>, java.io.Serializable, Cloneable, Comparable<MetricSnapshot> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("MetricSnapshot");

  private static final org.apache.thrift.protocol.TField METRIC_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("metricId", org.apache.thrift.protocol.TType.I64, (short)1);
  private static final org.apache.thrift.protocol.TField TS_FIELD_DESC = new org.apache.thrift.protocol.TField("ts", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField METRIC_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("metricType", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField LONG_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("longValue", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField DOUBLE_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("doubleValue", org.apache.thrift.protocol.TType.DOUBLE, (short)5);
  private static final org.apache.thrift.protocol.TField M1_FIELD_DESC = new org.apache.thrift.protocol.TField("m1", org.apache.thrift.protocol.TType.DOUBLE, (short)6);
  private static final org.apache.thrift.protocol.TField M5_FIELD_DESC = new org.apache.thrift.protocol.TField("m5", org.apache.thrift.protocol.TType.DOUBLE, (short)7);
  private static final org.apache.thrift.protocol.TField M15_FIELD_DESC = new org.apache.thrift.protocol.TField("m15", org.apache.thrift.protocol.TType.DOUBLE, (short)8);
  private static final org.apache.thrift.protocol.TField MEAN_FIELD_DESC = new org.apache.thrift.protocol.TField("mean", org.apache.thrift.protocol.TType.DOUBLE, (short)9);
  private static final org.apache.thrift.protocol.TField MIN_FIELD_DESC = new org.apache.thrift.protocol.TField("min", org.apache.thrift.protocol.TType.I64, (short)10);
  private static final org.apache.thrift.protocol.TField MAX_FIELD_DESC = new org.apache.thrift.protocol.TField("max", org.apache.thrift.protocol.TType.I64, (short)11);
  private static final org.apache.thrift.protocol.TField P50_FIELD_DESC = new org.apache.thrift.protocol.TField("p50", org.apache.thrift.protocol.TType.DOUBLE, (short)12);
  private static final org.apache.thrift.protocol.TField P75_FIELD_DESC = new org.apache.thrift.protocol.TField("p75", org.apache.thrift.protocol.TType.DOUBLE, (short)13);
  private static final org.apache.thrift.protocol.TField P95_FIELD_DESC = new org.apache.thrift.protocol.TField("p95", org.apache.thrift.protocol.TType.DOUBLE, (short)14);
  private static final org.apache.thrift.protocol.TField P98_FIELD_DESC = new org.apache.thrift.protocol.TField("p98", org.apache.thrift.protocol.TType.DOUBLE, (short)15);
  private static final org.apache.thrift.protocol.TField P99_FIELD_DESC = new org.apache.thrift.protocol.TField("p99", org.apache.thrift.protocol.TType.DOUBLE, (short)16);
  private static final org.apache.thrift.protocol.TField P999_FIELD_DESC = new org.apache.thrift.protocol.TField("p999", org.apache.thrift.protocol.TType.DOUBLE, (short)17);
  private static final org.apache.thrift.protocol.TField STDDEV_FIELD_DESC = new org.apache.thrift.protocol.TField("stddev", org.apache.thrift.protocol.TType.DOUBLE, (short)18);
  private static final org.apache.thrift.protocol.TField POINTS_FIELD_DESC = new org.apache.thrift.protocol.TField("points", org.apache.thrift.protocol.TType.STRING, (short)19);
  private static final org.apache.thrift.protocol.TField POINT_SIZE_FIELD_DESC = new org.apache.thrift.protocol.TField("pointSize", org.apache.thrift.protocol.TType.I32, (short)20);

  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
  static {
    schemes.put(StandardScheme.class, new MetricSnapshotStandardSchemeFactory());
    schemes.put(TupleScheme.class, new MetricSnapshotTupleSchemeFactory());
  }

  private long metricId; // required
  private long ts; // required
  private int metricType; // required
  private long longValue; // optional
  private double doubleValue; // optional
  private double m1; // optional
  private double m5; // optional
  private double m15; // optional
  private double mean; // optional
  private long min; // optional
  private long max; // optional
  private double p50; // optional
  private double p75; // optional
  private double p95; // optional
  private double p98; // optional
  private double p99; // optional
  private double p999; // optional
  private double stddev; // optional
  private ByteBuffer points; // optional
  private int pointSize; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    METRIC_ID((short)1, "metricId"),
    TS((short)2, "ts"),
    METRIC_TYPE((short)3, "metricType"),
    LONG_VALUE((short)4, "longValue"),
    DOUBLE_VALUE((short)5, "doubleValue"),
    M1((short)6, "m1"),
    M5((short)7, "m5"),
    M15((short)8, "m15"),
    MEAN((short)9, "mean"),
    MIN((short)10, "min"),
    MAX((short)11, "max"),
    P50((short)12, "p50"),
    P75((short)13, "p75"),
    P95((short)14, "p95"),
    P98((short)15, "p98"),
    P99((short)16, "p99"),
    P999((short)17, "p999"),
    STDDEV((short)18, "stddev"),
    POINTS((short)19, "points"),
    POINT_SIZE((short)20, "pointSize");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // METRIC_ID
          return METRIC_ID;
        case 2: // TS
          return TS;
        case 3: // METRIC_TYPE
          return METRIC_TYPE;
        case 4: // LONG_VALUE
          return LONG_VALUE;
        case 5: // DOUBLE_VALUE
          return DOUBLE_VALUE;
        case 6: // M1
          return M1;
        case 7: // M5
          return M5;
        case 8: // M15
          return M15;
        case 9: // MEAN
          return MEAN;
        case 10: // MIN
          return MIN;
        case 11: // MAX
          return MAX;
        case 12: // P50
          return P50;
        case 13: // P75
          return P75;
        case 14: // P95
          return P95;
        case 15: // P98
          return P98;
        case 16: // P99
          return P99;
        case 17: // P999
          return P999;
        case 18: // STDDEV
          return STDDEV;
        case 19: // POINTS
          return POINTS;
        case 20: // POINT_SIZE
          return POINT_SIZE;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __METRICID_ISSET_ID = 0;
  private static final int __TS_ISSET_ID = 1;
  private static final int __METRICTYPE_ISSET_ID = 2;
  private static final int __LONGVALUE_ISSET_ID = 3;
  private static final int __DOUBLEVALUE_ISSET_ID = 4;
  private static final int __M1_ISSET_ID = 5;
  private static final int __M5_ISSET_ID = 6;
  private static final int __M15_ISSET_ID = 7;
  private static final int __MEAN_ISSET_ID = 8;
  private static final int __MIN_ISSET_ID = 9;
  private static final int __MAX_ISSET_ID = 10;
  private static final int __P50_ISSET_ID = 11;
  private static final int __P75_ISSET_ID = 12;
  private static final int __P95_ISSET_ID = 13;
  private static final int __P98_ISSET_ID = 14;
  private static final int __P99_ISSET_ID = 15;
  private static final int __P999_ISSET_ID = 16;
  private static final int __STDDEV_ISSET_ID = 17;
  private static final int __POINTSIZE_ISSET_ID = 18;
  private int __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.LONG_VALUE,_Fields.DOUBLE_VALUE,_Fields.M1,_Fields.M5,_Fields.M15,_Fields.MEAN,_Fields.MIN,_Fields.MAX,_Fields.P50,_Fields.P75,_Fields.P95,_Fields.P98,_Fields.P99,_Fields.P999,_Fields.STDDEV,_Fields.POINTS,_Fields.POINT_SIZE};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.METRIC_ID, new org.apache.thrift.meta_data.FieldMetaData("metricId", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.TS, new org.apache.thrift.meta_data.FieldMetaData("ts", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.METRIC_TYPE, new org.apache.thrift.meta_data.FieldMetaData("metricType", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.LONG_VALUE, new org.apache.thrift.meta_data.FieldMetaData("longValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.DOUBLE_VALUE, new org.apache.thrift.meta_data.FieldMetaData("doubleValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.M1, new org.apache.thrift.meta_data.FieldMetaData("m1", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.M5, new org.apache.thrift.meta_data.FieldMetaData("m5", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.M15, new org.apache.thrift.meta_data.FieldMetaData("m15", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.MEAN, new org.apache.thrift.meta_data.FieldMetaData("mean", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.MIN, new org.apache.thrift.meta_data.FieldMetaData("min", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.MAX, new org.apache.thrift.meta_data.FieldMetaData("max", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.P50, new org.apache.thrift.meta_data.FieldMetaData("p50", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.P75, new org.apache.thrift.meta_data.FieldMetaData("p75", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.P95, new org.apache.thrift.meta_data.FieldMetaData("p95", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.P98, new org.apache.thrift.meta_data.FieldMetaData("p98", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.P99, new org.apache.thrift.meta_data.FieldMetaData("p99", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.P999, new org.apache.thrift.meta_data.FieldMetaData("p999", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.STDDEV, new org.apache.thrift.meta_data.FieldMetaData("stddev", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.POINTS, new org.apache.thrift.meta_data.FieldMetaData("points", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
    tmpMap.put(_Fields.POINT_SIZE, new org.apache.thrift.meta_data.FieldMetaData("pointSize", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(MetricSnapshot.class, metaDataMap);
  }

  public MetricSnapshot() {
  }

  public MetricSnapshot(
    long metricId,
    long ts,
    int metricType)
  {
    this();
    this.metricId = metricId;
    set_metricId_isSet(true);
    this.ts = ts;
    set_ts_isSet(true);
    this.metricType = metricType;
    set_metricType_isSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public MetricSnapshot(MetricSnapshot other) {
    __isset_bitfield = other.__isset_bitfield;
    this.metricId = other.metricId;
    this.ts = other.ts;
    this.metricType = other.metricType;
    this.longValue = other.longValue;
    this.doubleValue = other.doubleValue;
    this.m1 = other.m1;
    this.m5 = other.m5;
    this.m15 = other.m15;
    this.mean = other.mean;
    this.min = other.min;
    this.max = other.max;
    this.p50 = other.p50;
    this.p75 = other.p75;
    this.p95 = other.p95;
    this.p98 = other.p98;
    this.p99 = other.p99;
    this.p999 = other.p999;
    this.stddev = other.stddev;
    if (other.is_set_points()) {
      this.points = org.apache.thrift.TBaseHelper.copyBinary(other.points);
    }
    this.pointSize = other.pointSize;
  }

  public MetricSnapshot deepCopy() {
    return new MetricSnapshot(this);
  }

  @Override
  public void clear() {
    set_metricId_isSet(false);
    this.metricId = 0;
    set_ts_isSet(false);
    this.ts = 0;
    set_metricType_isSet(false);
    this.metricType = 0;
    set_longValue_isSet(false);
    this.longValue = 0;
    set_doubleValue_isSet(false);
    this.doubleValue = 0.0;
    set_m1_isSet(false);
    this.m1 = 0.0;
    set_m5_isSet(false);
    this.m5 = 0.0;
    set_m15_isSet(false);
    this.m15 = 0.0;
    set_mean_isSet(false);
    this.mean = 0.0;
    set_min_isSet(false);
    this.min = 0;
    set_max_isSet(false);
    this.max = 0;
    set_p50_isSet(false);
    this.p50 = 0.0;
    set_p75_isSet(false);
    this.p75 = 0.0;
    set_p95_isSet(false);
    this.p95 = 0.0;
    set_p98_isSet(false);
    this.p98 = 0.0;
    set_p99_isSet(false);
    this.p99 = 0.0;
    set_p999_isSet(false);
    this.p999 = 0.0;
    set_stddev_isSet(false);
    this.stddev = 0.0;
    this.points = null;
    set_pointSize_isSet(false);
    this.pointSize = 0;
  }

  public long get_metricId() {
    return this.metricId;
  }

  public void set_metricId(long metricId) {
    this.metricId = metricId;
    set_metricId_isSet(true);
  }

  public void unset_metricId() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __METRICID_ISSET_ID);
  }

  /** Returns true if field metricId is set (has been assigned a value) and false otherwise */
  public boolean is_set_metricId() {
    return EncodingUtils.testBit(__isset_bitfield, __METRICID_ISSET_ID);
  }

  public void set_metricId_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __METRICID_ISSET_ID, value);
  }

  public long get_ts() {
    return this.ts;
  }

  public void set_ts(long ts) {
    this.ts = ts;
    set_ts_isSet(true);
  }

  public void unset_ts() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TS_ISSET_ID);
  }

  /** Returns true if field ts is set (has been assigned a value) and false otherwise */
  public boolean is_set_ts() {
    return EncodingUtils.testBit(__isset_bitfield, __TS_ISSET_ID);
  }

  public void set_ts_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TS_ISSET_ID, value);
  }

  public int get_metricType() {
    return this.metricType;
  }

  public void set_metricType(int metricType) {
    this.metricType = metricType;
    set_metricType_isSet(true);
  }

  public void unset_metricType() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __METRICTYPE_ISSET_ID);
  }

  /** Returns true if field metricType is set (has been assigned a value) and false otherwise */
  public boolean is_set_metricType() {
    return EncodingUtils.testBit(__isset_bitfield, __METRICTYPE_ISSET_ID);
  }

  public void set_metricType_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __METRICTYPE_ISSET_ID, value);
  }

  public long get_longValue() {
    return this.longValue;
  }

  public void set_longValue(long longValue) {
    this.longValue = longValue;
    set_longValue_isSet(true);
  }

  public void unset_longValue() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LONGVALUE_ISSET_ID);
  }

  /** Returns true if field longValue is set (has been assigned a value) and false otherwise */
  public boolean is_set_longValue() {
    return EncodingUtils.testBit(__isset_bitfield, __LONGVALUE_ISSET_ID);
  }

  public void set_longValue_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LONGVALUE_ISSET_ID, value);
  }

  public double get_doubleValue() {
    return this.doubleValue;
  }

  public void set_doubleValue(double doubleValue) {
    this.doubleValue = doubleValue;
    set_doubleValue_isSet(true);
  }

  public void unset_doubleValue() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __DOUBLEVALUE_ISSET_ID);
  }

  /** Returns true if field doubleValue is set (has been assigned a value) and false otherwise */
  public boolean is_set_doubleValue() {
    return EncodingUtils.testBit(__isset_bitfield, __DOUBLEVALUE_ISSET_ID);
  }

  public void set_doubleValue_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __DOUBLEVALUE_ISSET_ID, value);
  }

  public double get_m1() {
    return this.m1;
  }

  public void set_m1(double m1) {
    this.m1 = m1;
    set_m1_isSet(true);
  }

  public void unset_m1() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __M1_ISSET_ID);
  }

  /** Returns true if field m1 is set (has been assigned a value) and false otherwise */
  public boolean is_set_m1() {
    return EncodingUtils.testBit(__isset_bitfield, __M1_ISSET_ID);
  }

  public void set_m1_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __M1_ISSET_ID, value);
  }

  public double get_m5() {
    return this.m5;
  }

  public void set_m5(double m5) {
    this.m5 = m5;
    set_m5_isSet(true);
  }

  public void unset_m5() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __M5_ISSET_ID);
  }

  /** Returns true if field m5 is set (has been assigned a value) and false otherwise */
  public boolean is_set_m5() {
    return EncodingUtils.testBit(__isset_bitfield, __M5_ISSET_ID);
  }

  public void set_m5_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __M5_ISSET_ID, value);
  }

  public double get_m15() {
    return this.m15;
  }

  public void set_m15(double m15) {
    this.m15 = m15;
    set_m15_isSet(true);
  }

  public void unset_m15() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __M15_ISSET_ID);
  }

  /** Returns true if field m15 is set (has been assigned a value) and false otherwise */
  public boolean is_set_m15() {
    return EncodingUtils.testBit(__isset_bitfield, __M15_ISSET_ID);
  }

  public void set_m15_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __M15_ISSET_ID, value);
  }

  public double get_mean() {
    return this.mean;
  }

  public void set_mean(double mean) {
    this.mean = mean;
    set_mean_isSet(true);
  }

  public void unset_mean() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MEAN_ISSET_ID);
  }

  /** Returns true if field mean is set (has been assigned a value) and false otherwise */
  public boolean is_set_mean() {
    return EncodingUtils.testBit(__isset_bitfield, __MEAN_ISSET_ID);
  }

  public void set_mean_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MEAN_ISSET_ID, value);
  }

  public long get_min() {
    return this.min;
  }

  public void set_min(long min) {
    this.min = min;
    set_min_isSet(true);
  }

  public void unset_min() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MIN_ISSET_ID);
  }

  /** Returns true if field min is set (has been assigned a value) and false otherwise */
  public boolean is_set_min() {
    return EncodingUtils.testBit(__isset_bitfield, __MIN_ISSET_ID);
  }

  public void set_min_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MIN_ISSET_ID, value);
  }

  public long get_max() {
    return this.max;
  }

  public void set_max(long max) {
    this.max = max;
    set_max_isSet(true);
  }

  public void unset_max() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __MAX_ISSET_ID);
  }

  /** Returns true if field max is set (has been assigned a value) and false otherwise */
  public boolean is_set_max() {
    return EncodingUtils.testBit(__isset_bitfield, __MAX_ISSET_ID);
  }

  public void set_max_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __MAX_ISSET_ID, value);
  }

  public double get_p50() {
    return this.p50;
  }

  public void set_p50(double p50) {
    this.p50 = p50;
    set_p50_isSet(true);
  }

  public void unset_p50() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __P50_ISSET_ID);
  }

  /** Returns true if field p50 is set (has been assigned a value) and false otherwise */
  public boolean is_set_p50() {
    return EncodingUtils.testBit(__isset_bitfield, __P50_ISSET_ID);
  }

  public void set_p50_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __P50_ISSET_ID, value);
  }

  public double get_p75() {
    return this.p75;
  }

  public void set_p75(double p75) {
    this.p75 = p75;
    set_p75_isSet(true);
  }

  public void unset_p75() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __P75_ISSET_ID);
  }

  /** Returns true if field p75 is set (has been assigned a value) and false otherwise */
  public boolean is_set_p75() {
    return EncodingUtils.testBit(__isset_bitfield, __P75_ISSET_ID);
  }

  public void set_p75_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __P75_ISSET_ID, value);
  }

  public double get_p95() {
    return this.p95;
  }

  public void set_p95(double p95) {
    this.p95 = p95;
    set_p95_isSet(true);
  }

  public void unset_p95() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __P95_ISSET_ID);
  }

  /** Returns true if field p95 is set (has been assigned a value) and false otherwise */
  public boolean is_set_p95() {
    return EncodingUtils.testBit(__isset_bitfield, __P95_ISSET_ID);
  }

  public void set_p95_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __P95_ISSET_ID, value);
  }

  public double get_p98() {
    return this.p98;
  }

  public void set_p98(double p98) {
    this.p98 = p98;
    set_p98_isSet(true);
  }

  public void unset_p98() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __P98_ISSET_ID);
  }

  /** Returns true if field p98 is set (has been assigned a value) and false otherwise */
  public boolean is_set_p98() {
    return EncodingUtils.testBit(__isset_bitfield, __P98_ISSET_ID);
  }

  public void set_p98_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __P98_ISSET_ID, value);
  }

  public double get_p99() {
    return this.p99;
  }

  public void set_p99(double p99) {
    this.p99 = p99;
    set_p99_isSet(true);
  }

  public void unset_p99() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __P99_ISSET_ID);
  }

  /** Returns true if field p99 is set (has been assigned a value) and false otherwise */
  public boolean is_set_p99() {
    return EncodingUtils.testBit(__isset_bitfield, __P99_ISSET_ID);
  }

  public void set_p99_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __P99_ISSET_ID, value);
  }

  public double get_p999() {
    return this.p999;
  }

  public void set_p999(double p999) {
    this.p999 = p999;
    set_p999_isSet(true);
  }

  public void unset_p999() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __P999_ISSET_ID);
  }

  /** Returns true if field p999 is set (has been assigned a value) and false otherwise */
  public boolean is_set_p999() {
    return EncodingUtils.testBit(__isset_bitfield, __P999_ISSET_ID);
  }

  public void set_p999_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __P999_ISSET_ID, value);
  }

  public double get_stddev() {
    return this.stddev;
  }

  public void set_stddev(double stddev) {
    this.stddev = stddev;
    set_stddev_isSet(true);
  }

  public void unset_stddev() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STDDEV_ISSET_ID);
  }

  /** Returns true if field stddev is set (has been assigned a value) and false otherwise */
  public boolean is_set_stddev() {
    return EncodingUtils.testBit(__isset_bitfield, __STDDEV_ISSET_ID);
  }

  public void set_stddev_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STDDEV_ISSET_ID, value);
  }

  public byte[] get_points() {
    set_points(org.apache.thrift.TBaseHelper.rightSize(points));
    return points == null ? null : points.array();
  }

  public ByteBuffer buffer_for_points() {
    return org.apache.thrift.TBaseHelper.copyBinary(points);
  }

  public void set_points(byte[] points) {
    this.points = points == null ? (ByteBuffer)null : ByteBuffer.wrap(Arrays.copyOf(points, points.length));
  }

  public void set_points(ByteBuffer points) {
    this.points = org.apache.thrift.TBaseHelper.copyBinary(points);
  }

  public void unset_points() {
    this.points = null;
  }

  /** Returns true if field points is set (has been assigned a value) and false otherwise */
  public boolean is_set_points() {
    return this.points != null;
  }

  public void set_points_isSet(boolean value) {
    if (!value) {
      this.points = null;
    }
  }

  public int get_pointSize() {
    return this.pointSize;
  }

  public void set_pointSize(int pointSize) {
    this.pointSize = pointSize;
    set_pointSize_isSet(true);
  }

  public void unset_pointSize() {
    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __POINTSIZE_ISSET_ID);
  }

  /** Returns true if field pointSize is set (has been assigned a value) and false otherwise */
  public boolean is_set_pointSize() {
    return EncodingUtils.testBit(__isset_bitfield, __POINTSIZE_ISSET_ID);
  }

  public void set_pointSize_isSet(boolean value) {
    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __POINTSIZE_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case METRIC_ID:
      if (value == null) {
        unset_metricId();
      } else {
        set_metricId((Long)value);
      }
      break;

    case TS:
      if (value == null) {
        unset_ts();
      } else {
        set_ts((Long)value);
      }
      break;

    case METRIC_TYPE:
      if (value == null) {
        unset_metricType();
      } else {
        set_metricType((Integer)value);
      }
      break;

    case LONG_VALUE:
      if (value == null) {
        unset_longValue();
      } else {
        set_longValue((Long)value);
      }
      break;

    case DOUBLE_VALUE:
      if (value == null) {
        unset_doubleValue();
      } else {
        set_doubleValue((Double)value);
      }
      break;

    case M1:
      if (value == null) {
        unset_m1();
      } else {
        set_m1((Double)value);
      }
      break;

    case M5:
      if (value == null) {
        unset_m5();
      } else {
        set_m5((Double)value);
      }
      break;

    case M15:
      if (value == null) {
        unset_m15();
      } else {
        set_m15((Double)value);
      }
      break;

    case MEAN:
      if (value == null) {
        unset_mean();
      } else {
        set_mean((Double)value);
      }
      break;

    case MIN:
      if (value == null) {
        unset_min();
      } else {
        set_min((Long)value);
      }
      break;

    case MAX:
      if (value == null) {
        unset_max();
      } else {
        set_max((Long)value);
      }
      break;

    case P50:
      if (value == null) {
        unset_p50();
      } else {
        set_p50((Double)value);
      }
      break;

    case P75:
      if (value == null) {
        unset_p75();
      } else {
        set_p75((Double)value);
      }
      break;

    case P95:
      if (value == null) {
        unset_p95();
      } else {
        set_p95((Double)value);
      }
      break;

    case P98:
      if (value == null) {
        unset_p98();
      } else {
        set_p98((Double)value);
      }
      break;

    case P99:
      if (value == null) {
        unset_p99();
      } else {
        set_p99((Double)value);
      }
      break;

    case P999:
      if (value == null) {
        unset_p999();
      } else {
        set_p999((Double)value);
      }
      break;

    case STDDEV:
      if (value == null) {
        unset_stddev();
      } else {
        set_stddev((Double)value);
      }
      break;

    case POINTS:
      if (value == null) {
        unset_points();
      } else {
        set_points((ByteBuffer)value);
      }
      break;

    case POINT_SIZE:
      if (value == null) {
        unset_pointSize();
      } else {
        set_pointSize((Integer)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case METRIC_ID:
      return Long.valueOf(get_metricId());

    case TS:
      return Long.valueOf(get_ts());

    case METRIC_TYPE:
      return Integer.valueOf(get_metricType());

    case LONG_VALUE:
      return Long.valueOf(get_longValue());

    case DOUBLE_VALUE:
      return Double.valueOf(get_doubleValue());

    case M1:
      return Double.valueOf(get_m1());

    case M5:
      return Double.valueOf(get_m5());

    case M15:
      return Double.valueOf(get_m15());

    case MEAN:
      return Double.valueOf(get_mean());

    case MIN:
      return Long.valueOf(get_min());

    case MAX:
      return Long.valueOf(get_max());

    case P50:
      return Double.valueOf(get_p50());

    case P75:
      return Double.valueOf(get_p75());

    case P95:
      return Double.valueOf(get_p95());

    case P98:
      return Double.valueOf(get_p98());

    case P99:
      return Double.valueOf(get_p99());

    case P999:
      return Double.valueOf(get_p999());

    case STDDEV:
      return Double.valueOf(get_stddev());

    case POINTS:
      return get_points();

    case POINT_SIZE:
      return Integer.valueOf(get_pointSize());

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case METRIC_ID:
      return is_set_metricId();
    case TS:
      return is_set_ts();
    case METRIC_TYPE:
      return is_set_metricType();
    case LONG_VALUE:
      return is_set_longValue();
    case DOUBLE_VALUE:
      return is_set_doubleValue();
    case M1:
      return is_set_m1();
    case M5:
      return is_set_m5();
    case M15:
      return is_set_m15();
    case MEAN:
      return is_set_mean();
    case MIN:
      return is_set_min();
    case MAX:
      return is_set_max();
    case P50:
      return is_set_p50();
    case P75:
      return is_set_p75();
    case P95:
      return is_set_p95();
    case P98:
      return is_set_p98();
    case P99:
      return is_set_p99();
    case P999:
      return is_set_p999();
    case STDDEV:
      return is_set_stddev();
    case POINTS:
      return is_set_points();
    case POINT_SIZE:
      return is_set_pointSize();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof MetricSnapshot)
      return this.equals((MetricSnapshot)that);
    return false;
  }

  public boolean equals(MetricSnapshot that) {
    if (that == null)
      return false;

    boolean this_present_metricId = true;
    boolean that_present_metricId = true;
    if (this_present_metricId || that_present_metricId) {
      if (!(this_present_metricId && that_present_metricId))
        return false;
      if (this.metricId != that.metricId)
        return false;
    }

    boolean this_present_ts = true;
    boolean that_present_ts = true;
    if (this_present_ts || that_present_ts) {
      if (!(this_present_ts && that_present_ts))
        return false;
      if (this.ts != that.ts)
        return false;
    }

    boolean this_present_metricType = true;
    boolean that_present_metricType = true;
    if (this_present_metricType || that_present_metricType) {
      if (!(this_present_metricType && that_present_metricType))
        return false;
      if (this.metricType != that.metricType)
        return false;
    }

    boolean this_present_longValue = true && this.is_set_longValue();
    boolean that_present_longValue = true && that.is_set_longValue();
    if (this_present_longValue || that_present_longValue) {
      if (!(this_present_longValue && that_present_longValue))
        return false;
      if (this.longValue != that.longValue)
        return false;
    }

    boolean this_present_doubleValue = true && this.is_set_doubleValue();
    boolean that_present_doubleValue = true && that.is_set_doubleValue();
    if (this_present_doubleValue || that_present_doubleValue) {
      if (!(this_present_doubleValue && that_present_doubleValue))
        return false;
      if (this.doubleValue != that.doubleValue)
        return false;
    }

    boolean this_present_m1 = true && this.is_set_m1();
    boolean that_present_m1 = true && that.is_set_m1();
    if (this_present_m1 || that_present_m1) {
      if (!(this_present_m1 && that_present_m1))
        return false;
      if (this.m1 != that.m1)
        return false;
    }

    boolean this_present_m5 = true && this.is_set_m5();
    boolean that_present_m5 = true && that.is_set_m5();
    if (this_present_m5 || that_present_m5) {
      if (!(this_present_m5 && that_present_m5))
        return false;
      if (this.m5 != that.m5)
        return false;
    }

    boolean this_present_m15 = true && this.is_set_m15();
    boolean that_present_m15 = true && that.is_set_m15();
    if (this_present_m15 || that_present_m15) {
      if (!(this_present_m15 && that_present_m15))
        return false;
      if (this.m15 != that.m15)
        return false;
    }

    boolean this_present_mean = true && this.is_set_mean();
    boolean that_present_mean = true && that.is_set_mean();
    if (this_present_mean || that_present_mean) {
      if (!(this_present_mean && that_present_mean))
        return false;
      if (this.mean != that.mean)
        return false;
    }

    boolean this_present_min = true && this.is_set_min();
    boolean that_present_min = true && that.is_set_min();
    if (this_present_min || that_present_min) {
      if (!(this_present_min && that_present_min))
        return false;
      if (this.min != that.min)
        return false;
    }

    boolean this_present_max = true && this.is_set_max();
    boolean that_present_max = true && that.is_set_max();
    if (this_present_max || that_present_max) {
      if (!(this_present_max && that_present_max))
        return false;
      if (this.max != that.max)
        return false;
    }

    boolean this_present_p50 = true && this.is_set_p50();
    boolean that_present_p50 = true && that.is_set_p50();
    if (this_present_p50 || that_present_p50) {
      if (!(this_present_p50 && that_present_p50))
        return false;
      if (this.p50 != that.p50)
        return false;
    }

    boolean this_present_p75 = true && this.is_set_p75();
    boolean that_present_p75 = true && that.is_set_p75();
    if (this_present_p75 || that_present_p75) {
      if (!(this_present_p75 && that_present_p75))
        return false;
      if (this.p75 != that.p75)
        return false;
    }

    boolean this_present_p95 = true && this.is_set_p95();
    boolean that_present_p95 = true && that.is_set_p95();
    if (this_present_p95 || that_present_p95) {
      if (!(this_present_p95 && that_present_p95))
        return false;
      if (this.p95 != that.p95)
        return false;
    }

    boolean this_present_p98 = true && this.is_set_p98();
    boolean that_present_p98 = true && that.is_set_p98();
    if (this_present_p98 || that_present_p98) {
      if (!(this_present_p98 && that_present_p98))
        return false;
      if (this.p98 != that.p98)
        return false;
    }

    boolean this_present_p99 = true && this.is_set_p99();
    boolean that_present_p99 = true && that.is_set_p99();
    if (this_present_p99 || that_present_p99) {
      if (!(this_present_p99 && that_present_p99))
        return false;
      if (this.p99 != that.p99)
        return false;
    }

    boolean this_present_p999 = true && this.is_set_p999();
    boolean that_present_p999 = true && that.is_set_p999();
    if (this_present_p999 || that_present_p999) {
      if (!(this_present_p999 && that_present_p999))
        return false;
      if (this.p999 != that.p999)
        return false;
    }

    boolean this_present_stddev = true && this.is_set_stddev();
    boolean that_present_stddev = true && that.is_set_stddev();
    if (this_present_stddev || that_present_stddev) {
      if (!(this_present_stddev && that_present_stddev))
        return false;
      if (this.stddev != that.stddev)
        return false;
    }

    boolean this_present_points = true && this.is_set_points();
    boolean that_present_points = true && that.is_set_points();
    if (this_present_points || that_present_points) {
      if (!(this_present_points && that_present_points))
        return false;
      if (!this.points.equals(that.points))
        return false;
    }

    boolean this_present_pointSize = true && this.is_set_pointSize();
    boolean that_present_pointSize = true && that.is_set_pointSize();
    if (this_present_pointSize || that_present_pointSize) {
      if (!(this_present_pointSize && that_present_pointSize))
        return false;
      if (this.pointSize != that.pointSize)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    List<Object> list = new ArrayList<Object>();

    boolean present_metricId = true;
    list.add(present_metricId);
    if (present_metricId)
      list.add(metricId);

    boolean present_ts = true;
    list.add(present_ts);
    if (present_ts)
      list.add(ts);

    boolean present_metricType = true;
    list.add(present_metricType);
    if (present_metricType)
      list.add(metricType);

    boolean present_longValue = true && (is_set_longValue());
    list.add(present_longValue);
    if (present_longValue)
      list.add(longValue);

    boolean present_doubleValue = true && (is_set_doubleValue());
    list.add(present_doubleValue);
    if (present_doubleValue)
      list.add(doubleValue);

    boolean present_m1 = true && (is_set_m1());
    list.add(present_m1);
    if (present_m1)
      list.add(m1);

    boolean present_m5 = true && (is_set_m5());
    list.add(present_m5);
    if (present_m5)
      list.add(m5);

    boolean present_m15 = true && (is_set_m15());
    list.add(present_m15);
    if (present_m15)
      list.add(m15);

    boolean present_mean = true && (is_set_mean());
    list.add(present_mean);
    if (present_mean)
      list.add(mean);

    boolean present_min = true && (is_set_min());
    list.add(present_min);
    if (present_min)
      list.add(min);

    boolean present_max = true && (is_set_max());
    list.add(present_max);
    if (present_max)
      list.add(max);

    boolean present_p50 = true && (is_set_p50());
    list.add(present_p50);
    if (present_p50)
      list.add(p50);

    boolean present_p75 = true && (is_set_p75());
    list.add(present_p75);
    if (present_p75)
      list.add(p75);

    boolean present_p95 = true && (is_set_p95());
    list.add(present_p95);
    if (present_p95)
      list.add(p95);

    boolean present_p98 = true && (is_set_p98());
    list.add(present_p98);
    if (present_p98)
      list.add(p98);

    boolean present_p99 = true && (is_set_p99());
    list.add(present_p99);
    if (present_p99)
      list.add(p99);

    boolean present_p999 = true && (is_set_p999());
    list.add(present_p999);
    if (present_p999)
      list.add(p999);

    boolean present_stddev = true && (is_set_stddev());
    list.add(present_stddev);
    if (present_stddev)
      list.add(stddev);

    boolean present_points = true && (is_set_points());
    list.add(present_points);
    if (present_points)
      list.add(points);

    boolean present_pointSize = true && (is_set_pointSize());
    list.add(present_pointSize);
    if (present_pointSize)
      list.add(pointSize);

    return list.hashCode();
  }

  @Override
  public int compareTo(MetricSnapshot other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(is_set_metricId()).compareTo(other.is_set_metricId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_metricId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.metricId, other.metricId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_ts()).compareTo(other.is_set_ts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_ts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ts, other.ts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_metricType()).compareTo(other.is_set_metricType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_metricType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.metricType, other.metricType);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_longValue()).compareTo(other.is_set_longValue());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_longValue()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.longValue, other.longValue);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_doubleValue()).compareTo(other.is_set_doubleValue());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_doubleValue()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.doubleValue, other.doubleValue);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_m1()).compareTo(other.is_set_m1());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_m1()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.m1, other.m1);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_m5()).compareTo(other.is_set_m5());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_m5()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.m5, other.m5);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_m15()).compareTo(other.is_set_m15());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_m15()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.m15, other.m15);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_mean()).compareTo(other.is_set_mean());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_mean()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mean, other.mean);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_min()).compareTo(other.is_set_min());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_min()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.min, other.min);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_max()).compareTo(other.is_set_max());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_max()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.max, other.max);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_p50()).compareTo(other.is_set_p50());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_p50()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.p50, other.p50);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_p75()).compareTo(other.is_set_p75());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_p75()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.p75, other.p75);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_p95()).compareTo(other.is_set_p95());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_p95()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.p95, other.p95);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_p98()).compareTo(other.is_set_p98());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_p98()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.p98, other.p98);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_p99()).compareTo(other.is_set_p99());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_p99()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.p99, other.p99);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_p999()).compareTo(other.is_set_p999());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_p999()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.p999, other.p999);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_stddev()).compareTo(other.is_set_stddev());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_stddev()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stddev, other.stddev);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_points()).compareTo(other.is_set_points());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_points()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.points, other.points);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_pointSize()).compareTo(other.is_set_pointSize());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_pointSize()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.pointSize, other.pointSize);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("MetricSnapshot(");
    boolean first = true;

    sb.append("metricId:");
    sb.append(this.metricId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("ts:");
    sb.append(this.ts);
    first = false;
    if (!first) sb.append(", ");
    sb.append("metricType:");
    sb.append(this.metricType);
    first = false;
    if (is_set_longValue()) {
      if (!first) sb.append(", ");
      sb.append("longValue:");
      sb.append(this.longValue);
      first = false;
    }
    if (is_set_doubleValue()) {
      if (!first) sb.append(", ");
      sb.append("doubleValue:");
      sb.append(this.doubleValue);
      first = false;
    }
    if (is_set_m1()) {
      if (!first) sb.append(", ");
      sb.append("m1:");
      sb.append(this.m1);
      first = false;
    }
    if (is_set_m5()) {
      if (!first) sb.append(", ");
      sb.append("m5:");
      sb.append(this.m5);
      first = false;
    }
    if (is_set_m15()) {
      if (!first) sb.append(", ");
      sb.append("m15:");
      sb.append(this.m15);
      first = false;
    }
    if (is_set_mean()) {
      if (!first) sb.append(", ");
      sb.append("mean:");
      sb.append(this.mean);
      first = false;
    }
    if (is_set_min()) {
      if (!first) sb.append(", ");
      sb.append("min:");
      sb.append(this.min);
      first = false;
    }
    if (is_set_max()) {
      if (!first) sb.append(", ");
      sb.append("max:");
      sb.append(this.max);
      first = false;
    }
    if (is_set_p50()) {
      if (!first) sb.append(", ");
      sb.append("p50:");
      sb.append(this.p50);
      first = false;
    }
    if (is_set_p75()) {
      if (!first) sb.append(", ");
      sb.append("p75:");
      sb.append(this.p75);
      first = false;
    }
    if (is_set_p95()) {
      if (!first) sb.append(", ");
      sb.append("p95:");
      sb.append(this.p95);
      first = false;
    }
    if (is_set_p98()) {
      if (!first) sb.append(", ");
      sb.append("p98:");
      sb.append(this.p98);
      first = false;
    }
    if (is_set_p99()) {
      if (!first) sb.append(", ");
      sb.append("p99:");
      sb.append(this.p99);
      first = false;
    }
    if (is_set_p999()) {
      if (!first) sb.append(", ");
      sb.append("p999:");
      sb.append(this.p999);
      first = false;
    }
    if (is_set_stddev()) {
      if (!first) sb.append(", ");
      sb.append("stddev:");
      sb.append(this.stddev);
      first = false;
    }
    if (is_set_points()) {
      if (!first) sb.append(", ");
      sb.append("points:");
      if (this.points == null) {
        sb.append("null");
      } else {
        org.apache.thrift.TBaseHelper.toString(this.points, sb);
      }
      first = false;
    }
    if (is_set_pointSize()) {
      if (!first) sb.append(", ");
      sb.append("pointSize:");
      sb.append(this.pointSize);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (!is_set_metricId()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'metricId' is unset! Struct:" + toString());
    }

    if (!is_set_ts()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'ts' is unset! Struct:" + toString());
    }

    if (!is_set_metricType()) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'metricType' is unset! Struct:" + toString());
    }

    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class MetricSnapshotStandardSchemeFactory implements SchemeFactory {
    public MetricSnapshotStandardScheme getScheme() {
      return new MetricSnapshotStandardScheme();
    }
  }

  private static class MetricSnapshotStandardScheme extends StandardScheme<MetricSnapshot> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, MetricSnapshot struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // METRIC_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.metricId = iprot.readI64();
              struct.set_metricId_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // TS
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.ts = iprot.readI64();
              struct.set_ts_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // METRIC_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.metricType = iprot.readI32();
              struct.set_metricType_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // LONG_VALUE
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.longValue = iprot.readI64();
              struct.set_longValue_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // DOUBLE_VALUE
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.doubleValue = iprot.readDouble();
              struct.set_doubleValue_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // M1
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.m1 = iprot.readDouble();
              struct.set_m1_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // M5
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.m5 = iprot.readDouble();
              struct.set_m5_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // M15
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.m15 = iprot.readDouble();
              struct.set_m15_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // MEAN
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.mean = iprot.readDouble();
              struct.set_mean_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // MIN
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.min = iprot.readI64();
              struct.set_min_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // MAX
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.max = iprot.readI64();
              struct.set_max_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 12: // P50
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.p50 = iprot.readDouble();
              struct.set_p50_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 13: // P75
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.p75 = iprot.readDouble();
              struct.set_p75_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 14: // P95
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.p95 = iprot.readDouble();
              struct.set_p95_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 15: // P98
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.p98 = iprot.readDouble();
              struct.set_p98_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 16: // P99
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.p99 = iprot.readDouble();
              struct.set_p99_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 17: // P999
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.p999 = iprot.readDouble();
              struct.set_p999_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 18: // STDDEV
            if (schemeField.type == org.apache.thrift.protocol.TType.DOUBLE) {
              struct.stddev = iprot.readDouble();
              struct.set_stddev_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 19: // POINTS
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.points = iprot.readBinary();
              struct.set_points_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 20: // POINT_SIZE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.pointSize = iprot.readI32();
              struct.set_pointSize_isSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, MetricSnapshot struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      oprot.writeFieldBegin(METRIC_ID_FIELD_DESC);
      oprot.writeI64(struct.metricId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TS_FIELD_DESC);
      oprot.writeI64(struct.ts);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(METRIC_TYPE_FIELD_DESC);
      oprot.writeI32(struct.metricType);
      oprot.writeFieldEnd();
      if (struct.is_set_longValue()) {
        oprot.writeFieldBegin(LONG_VALUE_FIELD_DESC);
        oprot.writeI64(struct.longValue);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_doubleValue()) {
        oprot.writeFieldBegin(DOUBLE_VALUE_FIELD_DESC);
        oprot.writeDouble(struct.doubleValue);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_m1()) {
        oprot.writeFieldBegin(M1_FIELD_DESC);
        oprot.writeDouble(struct.m1);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_m5()) {
        oprot.writeFieldBegin(M5_FIELD_DESC);
        oprot.writeDouble(struct.m5);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_m15()) {
        oprot.writeFieldBegin(M15_FIELD_DESC);
        oprot.writeDouble(struct.m15);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_mean()) {
        oprot.writeFieldBegin(MEAN_FIELD_DESC);
        oprot.writeDouble(struct.mean);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_min()) {
        oprot.writeFieldBegin(MIN_FIELD_DESC);
        oprot.writeI64(struct.min);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_max()) {
        oprot.writeFieldBegin(MAX_FIELD_DESC);
        oprot.writeI64(struct.max);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_p50()) {
        oprot.writeFieldBegin(P50_FIELD_DESC);
        oprot.writeDouble(struct.p50);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_p75()) {
        oprot.writeFieldBegin(P75_FIELD_DESC);
        oprot.writeDouble(struct.p75);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_p95()) {
        oprot.writeFieldBegin(P95_FIELD_DESC);
        oprot.writeDouble(struct.p95);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_p98()) {
        oprot.writeFieldBegin(P98_FIELD_DESC);
        oprot.writeDouble(struct.p98);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_p99()) {
        oprot.writeFieldBegin(P99_FIELD_DESC);
        oprot.writeDouble(struct.p99);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_p999()) {
        oprot.writeFieldBegin(P999_FIELD_DESC);
        oprot.writeDouble(struct.p999);
        oprot.writeFieldEnd();
      }
      if (struct.is_set_stddev()) {
        oprot.writeFieldBegin(STDDEV_FIELD_DESC);
        oprot.writeDouble(struct.stddev);
        oprot.writeFieldEnd();
      }
      if (struct.points != null) {
        if (struct.is_set_points()) {
          oprot.writeFieldBegin(POINTS_FIELD_DESC);
          oprot.writeBinary(struct.points);
          oprot.writeFieldEnd();
        }
      }
      if (struct.is_set_pointSize()) {
        oprot.writeFieldBegin(POINT_SIZE_FIELD_DESC);
        oprot.writeI32(struct.pointSize);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class MetricSnapshotTupleSchemeFactory implements SchemeFactory {
    public MetricSnapshotTupleScheme getScheme() {
      return new MetricSnapshotTupleScheme();
    }
  }

  private static class MetricSnapshotTupleScheme extends TupleScheme<MetricSnapshot> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, MetricSnapshot struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeI64(struct.metricId);
      oprot.writeI64(struct.ts);
      oprot.writeI32(struct.metricType);
      BitSet optionals = new BitSet();
      if (struct.is_set_longValue()) {
        optionals.set(0);
      }
      if (struct.is_set_doubleValue()) {
        optionals.set(1);
      }
      if (struct.is_set_m1()) {
        optionals.set(2);
      }
      if (struct.is_set_m5()) {
        optionals.set(3);
      }
      if (struct.is_set_m15()) {
        optionals.set(4);
      }
      if (struct.is_set_mean()) {
        optionals.set(5);
      }
      if (struct.is_set_min()) {
        optionals.set(6);
      }
      if (struct.is_set_max()) {
        optionals.set(7);
      }
      if (struct.is_set_p50()) {
        optionals.set(8);
      }
      if (struct.is_set_p75()) {
        optionals.set(9);
      }
      if (struct.is_set_p95()) {
        optionals.set(10);
      }
      if (struct.is_set_p98()) {
        optionals.set(11);
      }
      if (struct.is_set_p99()) {
        optionals.set(12);
      }
      if (struct.is_set_p999()) {
        optionals.set(13);
      }
      if (struct.is_set_stddev()) {
        optionals.set(14);
      }
      if (struct.is_set_points()) {
        optionals.set(15);
      }
      if (struct.is_set_pointSize()) {
        optionals.set(16);
      }
      oprot.writeBitSet(optionals, 17);
      if (struct.is_set_longValue()) {
        oprot.writeI64(struct.longValue);
      }
      if (struct.is_set_doubleValue()) {
        oprot.writeDouble(struct.doubleValue);
      }
      if (struct.is_set_m1()) {
        oprot.writeDouble(struct.m1);
      }
      if (struct.is_set_m5()) {
        oprot.writeDouble(struct.m5);
      }
      if (struct.is_set_m15()) {
        oprot.writeDouble(struct.m15);
      }
      if (struct.is_set_mean()) {
        oprot.writeDouble(struct.mean);
      }
      if (struct.is_set_min()) {
        oprot.writeI64(struct.min);
      }
      if (struct.is_set_max()) {
        oprot.writeI64(struct.max);
      }
      if (struct.is_set_p50()) {
        oprot.writeDouble(struct.p50);
      }
      if (struct.is_set_p75()) {
        oprot.writeDouble(struct.p75);
      }
      if (struct.is_set_p95()) {
        oprot.writeDouble(struct.p95);
      }
      if (struct.is_set_p98()) {
        oprot.writeDouble(struct.p98);
      }
      if (struct.is_set_p99()) {
        oprot.writeDouble(struct.p99);
      }
      if (struct.is_set_p999()) {
        oprot.writeDouble(struct.p999);
      }
      if (struct.is_set_stddev()) {
        oprot.writeDouble(struct.stddev);
      }
      if (struct.is_set_points()) {
        oprot.writeBinary(struct.points);
      }
      if (struct.is_set_pointSize()) {
        oprot.writeI32(struct.pointSize);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, MetricSnapshot struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.metricId = iprot.readI64();
      struct.set_metricId_isSet(true);
      struct.ts = iprot.readI64();
      struct.set_ts_isSet(true);
      struct.metricType = iprot.readI32();
      struct.set_metricType_isSet(true);
      BitSet incoming = iprot.readBitSet(17);
      if (incoming.get(0)) {
        struct.longValue = iprot.readI64();
        struct.set_longValue_isSet(true);
      }
      if (incoming.get(1)) {
        struct.doubleValue = iprot.readDouble();
        struct.set_doubleValue_isSet(true);
      }
      if (incoming.get(2)) {
        struct.m1 = iprot.readDouble();
        struct.set_m1_isSet(true);
      }
      if (incoming.get(3)) {
        struct.m5 = iprot.readDouble();
        struct.set_m5_isSet(true);
      }
      if (incoming.get(4)) {
        struct.m15 = iprot.readDouble();
        struct.set_m15_isSet(true);
      }
      if (incoming.get(5)) {
        struct.mean = iprot.readDouble();
        struct.set_mean_isSet(true);
      }
      if (incoming.get(6)) {
        struct.min = iprot.readI64();
        struct.set_min_isSet(true);
      }
      if (incoming.get(7)) {
        struct.max = iprot.readI64();
        struct.set_max_isSet(true);
      }
      if (incoming.get(8)) {
        struct.p50 = iprot.readDouble();
        struct.set_p50_isSet(true);
      }
      if (incoming.get(9)) {
        struct.p75 = iprot.readDouble();
        struct.set_p75_isSet(true);
      }
      if (incoming.get(10)) {
        struct.p95 = iprot.readDouble();
        struct.set_p95_isSet(true);
      }
      if (incoming.get(11)) {
        struct.p98 = iprot.readDouble();
        struct.set_p98_isSet(true);
      }
      if (incoming.get(12)) {
        struct.p99 = iprot.readDouble();
        struct.set_p99_isSet(true);
      }
      if (incoming.get(13)) {
        struct.p999 = iprot.readDouble();
        struct.set_p999_isSet(true);
      }
      if (incoming.get(14)) {
        struct.stddev = iprot.readDouble();
        struct.set_stddev_isSet(true);
      }
      if (incoming.get(15)) {
        struct.points = iprot.readBinary();
        struct.set_points_isSet(true);
      }
      if (incoming.get(16)) {
        struct.pointSize = iprot.readI32();
        struct.set_pointSize_isSet(true);
      }
    }
  }

}

